﻿using System.Diagnostics;

namespace CoverageRunner.Core;

public class CommonTools
{
    public static void ShowFileInExplorer(string path)
    {
        if (File.Exists(path))
        {
            var fullPath = Path.GetFullPath(path);
            var arguments = $"/select, {fullPath}";
            Process.Start("explorer.exe", arguments);
        }
        else
        {
            throw new ArgumentException($"path \"{path}\" non exists!!");
        }
    }

    public static void OpenHtml(string path)
    {
        if (File.Exists(path))
        {
            ProcessStartInfo info = new ProcessStartInfo
            {
                FileName = "explorer.exe",
                Arguments = $"\"{Path.GetFullPath(path)}\""
            };
            Process.Start(info);
        }
        else
        {
            throw new ArgumentException($"path \"{path}\" non exists!!");
        }
    }
}